{template 'common/header'}
<ul class="nav nav-tabs" id="myTab">
	<li><a href="{php echo $this->createWebUrl('index',array('doo'=>'begging','op'=>'manage'));}">打赏列表</a></li>
	<li><a href="{php echo $this->createWebUrl('index',array('doo'=>'begging','op'=>'list'));}">打赏帖子列表</a></li>
	<li class="active"><a href="{php echo $this->createWebUrl('index',array('doo'=>'begging','op'=>'post'));}">添加打赏帖子</a></li>
</ul>
<script type="text/javascript" src="resource/js/lib/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="resource/js/lib/jquery-ui-1.10.3.min.js"></script>
<script>
    require(['jquery', 'angular', 'util', 'underscore'], function($, angular, u, _){

        $(function(){
            angular.module('app', []).controller('custom', function($scope, $http) {
                $scope.submit = function() {
                    var message = '';
                    
                    if(message) {
                        u.message(message);
                    } else {
                        $('#theform')[0].submit();
                    }
                };
            });
            angular.bootstrap(document, ['app']);
        });
    });

</script>
<style>

</style>
<div class="clearfix">
    <form id="theform" class="form form-horizontal ng-cloak" action="" method="post" ng-controller="custom">
        <div class="panel panel-default">
            <div class="panel-heading">
            	{loop $types $t}
                	<a href="{php echo $this->createWebUrl('forum_post',array('id'=>$id,'type'=>$t['code']))}" class="btn {if $t['code'] == $_GPC['type']}btn-success{else}btn-default{/if}">添加{$t['title']}</a>
             	{/loop}
             </div>
            <div class="panel-body">
            	
                <div class="form-group">
                    <label class="col-sm-2 control-label">所属主题</label>
                    <div class="col-sm-5">
                    
                    	<select name="fid" class="form-control" style="border: none;">
		                   {loop $cats $cat}
		            		<option value="{$cat['typeid']}" {if $cat['typeid']==$id}selected{/if} {if !empty($cat['ch'])}disabled{/if}>|{$cat['name']}</option>
		            			{loop $cat['ch'] $ca}
		            				<option value="{$ca['typeid']}" {if $ca['typeid']==$id}selected{/if}>--|{$ca['name']}</option>
		            			{/loop}
		            		{/loop}
		            	</select>
                    </div>
                </div>
                
                <div class="form-group">
                    <label class="col-sm-2 control-label">标题</label>
                    <div class="col-sm-5">
                        <input class="form-control" type="text" name="title" value="{$setting['title']}"/>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">标签</label>
                    <div class="col-sm-5">
                    	{if $tabs}
					  {loop $tabs $t}
					  <label class="btn btn-default {if $setting['tab'] == $t['code']}active{/if}">
					    <input type="checkbox" name="tab" value="{php echo $t['code']}"  {if $setting['tab'] == $t['code']}checked{/if}>{$t['title']}
					  </label>
					  {/loop}
					  {/if}
                    </div>
                </div>
                
                <div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">详情</label>
					<div class="col-sm-9 col-xs-12">
						{php echo tpl_ueditor('content', $setting['content']);}
					</div>
				</div>
				
                <div class="form-group">
                    <label class="col-sm-2 control-label">图片</label>
                    <div class="col-sm-5">
                        {php echo tpl_form_field_multi_image('thumb',$setting['thumb'])}
                    </div>
                </div>
                
                <div class="form-group">
                    <label class="col-sm-2 control-label">语音资源</label>
                    <div class="col-sm-5">
                        {php echo tpl_form_field_multi_audio('audio',$setting['audio'])}
                    </div>
                </div>
                
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
                    <div class="col-md-2 col-lg-1">
                        <input type="button" value="保存" class="btn btn-primary btn-block" ng-click="submit();" />
                        <input type="hidden" name="token" value="{$_W['token']}" />
                    </div>
                </div>
            </div>
        </div>
        
    </form>
</div>
{template 'common/footer'}
